<template>
  <div class="sharemore">
    <van-nav-bar title="面试技巧">
      <template #left>
        <i @click="goBack" class="icon iconfont iconbtn_nav_back leftArro"></i>
      </template>
    </van-nav-bar>
    <div class="search" @click="$router.push('/sharesearch')">
      <i class="iconfont iconicon_search"></i>请输入关键字
    </div>

    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <faceshare
        :item="item"
        v-for="(item, index) in shareList"
        :key="index"
      ></faceshare>
    </van-list>
  </div>
</template>
<script>
import faceshare from '@/views/home/find/faceshare.vue'
import { apiGetShareData } from '@/api/find'
export default {
  components: {
    faceshare
  },
  created () {},
  data () {
    return {
      shareList: [],
      loading: false,
      finished: false,
      limit: 5,
      start: 0
    }
  },
  methods: {
    // 下拉加载数据
    async onLoad () {
      const res = await apiGetShareData({
        limit: this.limit,
        start: this.start
      })
      this.shareList.push(...res.data.list)
      console.log('哈哈哈哈:', this.shareList)

      this.start += this.limit
      this.loading = false
      if (this.shareList.length >= res.data.total) {
        this.finished = true
      }
      console.log(res)
    },
    goBack () {
      this.$router.go(-1)
    }
  }
}
</script>
<style lang="less" scoped>
.sharemore {
  font-size: 12px;
  .search {
    height: 30px;
    line-height: 30px;
    margin: 0 15px;
    border-radius: 20px;
    background-color: #eee;
    color: #ccc;
    text-align: center;
  }
  /deep/ .van-nav-bar__left {
    padding: 0;
  }
  .leftArro {
    font-size: 44px;
  }
  .faceshare {
    padding: 15px;
    margin: 10px 0;
    font-size: 12px;

    .title {
      font-size: 16px;
    }
    .introduce {
      font-size: 14px;
      text-overflow: -o-ellipsis-lastline;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      margin: 10px 0 20px 0;
      color: #666;
    }
    .other {
      display: flex;
      line-height: 27px;
      color: #666;
      .user {
        display: flex;
        flex: 1;
        align-content: center;
        .name {
          margin-left: 10px;
        }
      }
      .iconImg {
        width: 30px;
        height: 30px;
        border-radius: 50%;
      }
      .view {
        margin: 0 10px 0 15px;
      }
      .star {
        margin: 0 10px 0 20px;
      }
    }
  }
}
</style>
